package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: syyyy
 * Date: 2025-07-08
 * Time: 18:56
 */
public class SearchBook implements IOperation{
    public void work(BookList bookList){
        int i=0;
        System.out.println("*****搜索界面*****");
        System.out.println("请输入你要找的书：");
        Scanner scanner=new Scanner(System.in);
        String name=scanner.nextLine();
        for (i = 0; i < bookList.getUsedSize(); i++) {
            Book book=bookList.getBooks(i);
            if(name.equals(book.getName())){
                System.out.println(book);
                break;
            }
        }
        if(i==bookList.getUsedSize()){
            System.out.println("没有你要找的书哦！");
        }


    }
}
